#ifndef __DD_CUBE_H__
#define __DD_CUBE_H__

#include "geode.h"
#include "Vector3.h"
#include "FrustumMath.h"

extern bool CULLING;
extern int CULLED;

class cube : public geode {
 public:
	double length;
	Vector3 color;

        cube(double length, Vector3 color)
		: length(length), color(color)
	{
		bounding_radius=length;
	}
	
	void draw(Matrix4 *C, FrustumMath fmath)
	{
		if (CULLING && bounding_radius != 0.0 && fmath.min_distance((*C).getTranslation()) < -bounding_radius) {
			CULLED++;
                        return;
		}
	
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();
		glMultMatrixd(C->getGLMatrix());
		glColor3f(color[0], color[1], color[2]);
		glutSolidCube(length);
		glPopMatrix();
	}
};

#endif
